<script lang="ts" setup>
import { computed } from 'vue';

import { useAntdDesignTokens } from '@vben/hooks';
import { preferences, usePreferences } from '@vben/preferences';

import { App, ConfigProvider, theme } from 'ant-design-vue';

import { antdLocale } from '#/locales';

defineOptions({ name: 'App' });

const { isDark } = usePreferences();
const { tokens } = useAntdDesignTokens();

const tokenTheme = computed(() => {
  const algorithm = isDark.value
    ? [theme.darkAlgorithm]
    : [theme.defaultAlgorithm];

  // antd 紧凑模式算法
  if (preferences.app.compact) {
    algorithm.push(theme.compactAlgorithm);
  }

  return {
    algorithm,
    token: tokens,
  };
});

// const dictStore = useDictStore();
// if (dictStore.initDict) {
//   dictStore.setDictMap();
// }
</script>

<template>
  <ConfigProvider :locale="antdLocale" :theme="tokenTheme">
    <App>
      <RouterView />
    </App>
  </ConfigProvider>
</template>

<style>
/* .vxebasic-table-container {
  flex: auto;
  min-height: 300px;
}

.ant-btn {
  display: flex;
  align-items: center;
}

.ant-modal-confirm-btns {
  display: flex;
  justify-content: flex-end;
}

.ant-btn__warning {
  @apply bg-warning text-warning-foreground hover:bg-warning/90 shadow;
}

.ant-checkbox-disabled .ant-checkbox-inner {
  background: #fafafa;
  color: #333;
}

.ant-input-number-disabled {
  background: #fafafa;
  color: #333;
}

.ant-input-affix-wrapper-disabled,
.ant-input-affix-wrapper[disabled] {
  background: #fafafa;
  color: #333;
}

.ant-radio-wrapper-disabled {
  background: #fafafa;
  color: #333;
}
.ant-radio-wrapper .ant-radio-disabled .ant-radio-inner {
  background-color: rgba(50, 54, 57, 0.04);
  border-color: hsl(240 5.9% 90%);
}

.ant-picker.ant-picker-disabled {
  background: #fafafa;
  color: #333;
}

.ant-select-disabled.ant-select:not(.ant-select-customize-input)
  .ant-select-selector {
  background: #fafafa;
  color: #333;
}

.ant-picker .ant-picker-input > input-disabled,
.ant-picker .ant-picker-input > input[disabled] {
  background: #fafafa;
  color: #333 !important;
}

.ant-input-disabled,
.ant-input[disabled] {
  background: #fafafa;
  color: #333;
}

.c-input-right .ant-input-number-input-wrap input {
  text-align: right;
  padding-right: 23px;
} */
</style>
